pop, drop & get with basic range feature for stringlist#514
pop, drop & get with basic range feature for stringlist#514aman-godara wants to merge 22 commits intofortran-lang:masterfrom
Conversation
|
Any suggestions on better naming convention? Should I rather call |
|
This is highly subjective but FWIW, I would prefer For the function that does not return the deleted element I am fine with both Did you have any time to see what are the choices of other languages for similar functions? |
|
Python uses
|
|
How about get_and_remove or get_remove? That makes the function completely
clear, albeit via a more verbose name.
Op di 7 sep. 2021 om 15:29 schreef Aman Godara ***@***.***>:
… Python uses pop (returns deleted item) and remove (no return)
Java doesn't have any function equivalent of pop (or atleast I couldn't
find one), it has remove function (no return).
pop function is used whenever deleted item is returned, otherwise remove
and delete functions both are used by programming languages. Though, I
could find only one occurrence where delete was used to remove elements.
Also, some languages uses pop() (with no arguments) as a way to allow a
user to make a list behave like a stack or a queue.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#514 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN6YR7NQ6N7APHXMGEGK4LUAYHTBANCNFSM5DQYEJAQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
|
I think |
|
Based on my experience with past discussions, we are trying to provide a familiar interface to the user of Based on the other suggestions, my preference is
I do not have strong opinions on this, though. |
|
I added a basic range feature to We can discuss the behaviour of non-basic range feature for I think atleast a basic range feature should be added to |
|
Thank you. I personally don't like that out of bounds indexes are ignored: I'd like to be notified (at least with a warning, if not by an error) in these cases. Based on my experience, out of bounds indexes are the consequence of upstream bugs that would be difficult to identify, if ignored. However, I believe that a choice in this sense might have been already made during the initial implementation of
Good point, I agree. |
4391972 to
a02c5ed
Compare
|
I am under the impression that adding the |
Yeah, that's right. Let me rename PR. |
Co-authored-by: Emanuele Pagone <epagone.dev@gmail.com>
Co-authored-by: Emanuele Pagone <epagone.dev@gmail.com>
77bca62 to
2b3a5ef
Compare
|
This PR is blocked by: #552 |
get_engine func takes an integer stride_vector which decides the number of strides to take between indexes. get_range_idx func takes stride of type stringlist_index_type: fidx(+3) means takes +3 as stride (jump 3 indexes to right) fidx(-3) means takes -3 as stride (jump 3 indexes to left) bidx(+3) means takes -3 as stride (jump 3 indexes to left) bidx(-3) means takes +3 as stride (jump 3 indexes to right)
get_impl comes in the middle of get_engine and get_idx routines This allows to get i-th element inside the module using integer indexes

Delete function to
stdlib_stringlistTasks:
impure) to stringlistdeletetopopand also addeddropfunctionpop,dropandgetmoveofstdlib_string_typepure and some other subroutines which should have been pure